import json


data_pth = "/home/ubuntu/rubbish/data/SENTI_ROBUST/train.tsv"
out_name = "data1.json"
data1 = []
with open(data_pth, 'r') as f:
    lines = f.read().split('\n')[1:1000]

for line in lines:
    try:
        label, text_a = tuple(line.split('\t'))
    except:
        continue
    prompt = f"""
请完成一个情感鲁棒性评估任务。
评论是：{text_a},
请输出评论的情感（正面/负面）
注意输出格式是一个词（正面/负面），不要输出其它
"""
    temp = [prompt, "正面" if "1" in label else "负面"]
    data1.append(temp)

with open(out_name, 'w') as f:
    json.dump(data1, f, ensure_ascii=False, indent=4)
